<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});


// ==============================================================
// ==============================================================

// sanctum

// 用户注册
Route::post('/register', 'Api\RegisterController@register');

// 生成令牌
Route::post('/token', 'Api\TokenController@createToken');

// 获取令牌
Route::get('/token', 'Api\TokenController@getToken');

// 测试
Route::middleware('auth:sanctum')->get('/data/test001', 'Api\DataController@test001');
// {"message":"Unauthenticated."}


//Route::middleware('auth:sanctum')->get('/data/test001', function (Request $request) {
//    return '/sanctum/test001';
//});



Route::get('/hash', function () {
    return Hash::make('1qaz3edc', ['rounds' => 15]);
});


// test
Route::get('/hashMake001', 'Api\TestController@hashMake001');
Route::get('/hashMake002', 'Api\TestController@hashMake002');
Route::get('/hashMake003', 'Api\TestController@hashMake003');
Route::get('/hashMake004', 'Api\TestController@hashMake004');
Route::get('/hashMake005', 'Api\TestController@hashMake005');

Route::get('/passwordHash001', 'Api\TestController@passwordHash001');
Route::get('/passwordHash002', 'Api\TestController@passwordHash002');

Route::get('/passwordVerify001', 'Api\TestController@passwordVerify001');
Route::get('/passwordVerify002', 'Api\TestController@passwordVerify002');
Route::get('/passwordVerify003', 'Api\TestController@passwordVerify003');
Route::get('/passwordVerify004', 'Api\TestController@passwordVerify004');
